#ifndef _MEM_BLOCK_H_
#define _MEM_BLOCK_H_

#include "obmp_type.h"

typedef struct {
    S32         alloced;
    S32         used;
} block_stats_t;

void *clib_malloc(size_t size);

void clib_free(void *ptr);

void *clib_calloc(size_t nmemb, size_t size);

void *clib_realloc(void *ptr, size_t size);

void *clib_reallocarray(void *ptr, size_t nmemb, size_t size);

size_t clib_malloc_usable_size(void *ptr);

mem_block_info_t **mem_block_init(U32 block_cnt);

void release_tcache_chunk(struct st_chunk **chunk);

void alloc_tcache_chunk(struct st_chunk **chunk, size_t cache_size);

void *get_mem_from_block(struct st_chunk *chunk, mem_block_info_t *mem_block, size_t size);

void *get_mem_from_clib(size_t size);

S32 get_block_status(void *base_addr, mem_block_info_t *blk, block_stats_t *blk_stat);

#endif